/*
*    Reversi Contender homepage:  http://code.google.com/p/reversi-contender
*
*    copyright 2011 steven sims <steven.joseph.sims at gmail.com>
*
*    This file is part of Reversi Contender.
*
*    Reversi Contender is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    Reversi Contender is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with Reversi Contender.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.threadswarm.reversi;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import org.threadswarm.reversi.bot.ReversiBot;
import org.threadswarm.reversi.gui.CellComponent;

/**
 *
 * @author steve
 */
public class GameSession {

    private final static GameSession INSTANCE = new GameSession();
    
    private volatile Status playerStatus = Status.BLACK;
    private volatile boolean markAvailable = true;
    private volatile boolean availInsertionAnimationEnabled = true;
    private volatile boolean advancedMode = false;
    private AtomicInteger depth = new AtomicInteger(4);
    private List<CellComponent> availableInsertionsList = new CopyOnWriteArrayList<CellComponent>();
    private volatile ReversiBot bot;

    private GameSession(){}

    public Status getPlayerStatus() {
        return playerStatus;
    }

    public void setPlayerStatus(Status playerStatus) {
        this.playerStatus = playerStatus;
    }

    public void setMarkAvailable(boolean markAvailable) {
        this.markAvailable = markAvailable;
    }

    public boolean isMarkAvailable() {
        return markAvailable;
    }

    public boolean isAdvancedMode() {
        return advancedMode;
    }

    public void setAdvancedMode(boolean advancedMode) {
        this.advancedMode = advancedMode;
    }

    public int getDepth(){
        return depth.get();
    }

    public void setDepth(int depth){
        this.depth.set(depth);
    }
    
    public void setReversiBot(ReversiBot bot) {
        this.bot = bot;
    }
    
    public ReversiBot getReversiBot() {
        return bot;
    }

    public static GameSession getInstance() {
        return INSTANCE;
    }

    public boolean isAvailInsertionAnimationEnabled() {
        return availInsertionAnimationEnabled;
    }

    public void setAvailInsertionAnimationEnabled(boolean availInsertionAnimationEnabled) {
        this.availInsertionAnimationEnabled = availInsertionAnimationEnabled;
    }
    
    public List<CellComponent> getAvailableInsertionsList() {
        return availableInsertionsList;
    }

}
